package com.bian.task.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author bianpengfei
 * @create 2019-02-06 15:40
 **/

@Service
public class AsyncService {

    // 告诉spring这是一个异步方法
    @Async
    public void hello() {
        System.out.println("处理数据之前...");
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("处理数据中...");
    }
}

